*USER NOTE: This .do file lists syntax for replicating all empirical tables in the paper and figures 2 and 3
*See Readme file for variable definitions

** Use transfers data
use "Financial Solidarity Replication Data.dta"

*Table 3: 
reg adjtransper  anyretrenchlag1 ballot_elecs i.year i.statenum , cluster(statenum)
reg adjtransper anyretrenchlag1 ballot_elecs i.year i.statenum  if md==1 , cluster(statenum)
reg ptransfer anyretrenchlag1 ballot_elecs i.year i.statenum , cluster(statenum)
reg ptransfer anyretrenchlag1 ballot_elecs  i.year i.statenum  if md==1, cluster(statenum)

*Table 4: 
reg adjtransper i.year i.statenum banfeeslag1   ballot_elecs if md==1, cluster(statenum)
reg adjtransper i.year  i.statenum rescheckofflag1  ballot_elecs if md==1, cluster(statenum)
reg adjtransper i.year  i.statenum  cbrestrictlag1 ballot_elecs if md==1, cluster(statenum)

*** Use campaign contribution data
use "Campaign Contributions Replication Data.dta"

*Figure 2
probit neamoney i.year i.s anyretrenchlag1 ballot_elecs gub_elecs legelections repcont if year>2002, cluster(s)
estimates store one
probit neamoney i.year i.s anyretrenchlag1 ballot_elecs gub_elecs legelections repcont if year>2002  & md == 1, cluster(s)
estimates store two

coefplot (one, label("Full Sample") msymbol(circle_hollow)) (two, label("Restricted Sample") msymbol(triangle_hollow)), keep(anyretrenchlag1 ballot_elecs gub_elecs legelections repcont) ///
rename(anyretrenchlag1 = "Any Retrenchment" ballot_elecs = "Ballot Initiative" ///
 gub_elecs = "Gubernatorial Election"  legelections  = "State Legislative Election" repcont = "Republican Legislature") ///
levels(95) ciopts(recast(. rcap))  xline(0)  

*Figure 3
probit neamoney i.year i.s atleast2lag ballot_elecs gub_elecs legelections repcont if year>2002 & md == 1, cluster(s)
margins, at(atleast2lag=(0 1 2) ballot_elecs = 0 gub_elecs = 1 legelections =1 repcont=1)
marginsplot, title(" ") xtitle(" " "Probability of NEA Campaign Donation") xscale(r(0 1)) xlabel(0(.2) 1) ///
horizontal  ytitle(" ")  ylabel(0 "No Retrenchment" 1 "One Retrenchment Law" 2 "At Least Two Laws") ///
ciopts(recast(. rcap)) 







